FROM php:7.1.33-fpm
RUN apt-get update && apt-get install -y \
        wget \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
        libcurl4-openssl-dev \
        bzip2 \
        libbz2-dev \
        cmake \
        libmemcached-dev \
        git \
    && echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config \
#    && ssh-keygen -t rsa -P "" -f "/root/.ssh/id_rsa" \
    && wget "https://getcomposer.org/download/1.10.24/composer.phar" \
    && mv composer.phar /bin/composer && chmod +x /bin/composer \
#    && wget "https://pecl.php.net/get/swoole-4.5.2.tgz" \
#    && tar zxf swoole-4.5.2.tgz && cd swoole-4.5.2 && phpize && ./configure && make && make install \
#    && wget https://github.com/TarsPHP/tars-extension/archive/refs/tags/0.1.2.tar.gz \
#    && tar zxf 0.1.2.tar.gz && cd tars-extension-0.1.2 && phpize && ./configure && make && make install \
    && pecl channel-update pecl.php.net \
    && pecl install  memcached \
    && docker-php-source extract && wget "https://pecl.php.net/get/redis-5.2.2.tgz" && tar zxf redis-5.2.2.tgz && mv redis-5.2.2 /usr/src/php/ext/redis \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd pdo pdo_mysql zip mysqli redis \
    && docker-php-ext-enable swoole phptars memcached redis \
    && cd .. && rm -fr swoole-4.5.2 \
    && composer config -g secure-http false \
    && composer config -g repositories.xeslib composer http://packagist.xesv5.com:8093 \
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
    && docker-php-source delete
